home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / 123_01.zip / DIO.H < prev    next >
Text File  |  1993-06-07  |  3KB  |  113 lines

  1. /*
  2.     New version of dio.h
  3.     source:  dio.h
  4.     version: May 14, 1982; November 7, 1982; February 22, 1983
  5.  
  6.     adapted from dio.h by:
  7.  
  8.     Edward K. Ream
  9.     1850 Summit Ave.
  10.     Madison, WI 53705
  11.     (608) 231 - 2952
  12. */
  13.  
  14.  
  15. /*
  16. the new version of dio.h is very similar to the old
  17. these exceptions:
  18.  
  19.  
  20. 1.  I have added the following variables to dio.h:
  21.     _deflag, _dispec, _dospec, _despec and _debuf
  22.     These variables are needed by dio.c.
  23.  
  24. 2.  The DEV_TTY definition is new.
  25.  
  26. 3.  I have added comments about i/o redirection.
  27.  
  28. 4.  The constants STD_IN, STD_OUT etc were copied
  29.     to this file from STDLIB1.C.
  30.  
  31. All changes from the old version of dio.h are marked:
  32. ----- CHANGE -----
  33.  
  34. file information:
  35.  
  36.    Units 0, 1, and 4 are the STD_IN, STD_OUT and STD_ERR units.
  37. By default, these units are the same as the user's console,
  38. but these units may be redirected to files (or special files)
  39. via the command line characters >, < and @.
  40.  
  41.    Units 2 and 3 and 5 are special files.
  42. Each special file is assigned permanently to one device.
  43. Units 0, 1, and 4 may be redirected to these files.
  44. Additionally, I/O may be done directly to these
  45. files without first doing a call to fopen().
  46.  
  47.    Unit 5 is a new special file, DEV_TTY.  This is always
  48. the user's console.  I/O redirection has NO effect on this
  49. special file.  If you say putc(c, DEV_TTY) then c will go
  50. to the console even if STD_OUT has been directed elsewhere.
  51.  
  52.    All other units are disk files.
  53. These units are usually opened by calling fopen().
  54. However, units 0, 1, and 4 may be redirected to disk units
  55. via the command line.
  56.  
  57. */
  58.  
  59.  
  60. /* ----- CHANGE ----- constants copied from STDLIB1.C */
  61.  
  62. #define STD_IN    0
  63. #define STD_OUT 1
  64. #define STD_ERR 4
  65.  
  66. #define DEV_LST 2
  67. #define DEV_RDR 3
  68. #define DEV_PUN 3
  69.  
  70. /* ----- CHANGE ----- new definitions */
  71.  
  72. #define DEV_TTY 5        /* ALWAYS the console */
  73. #define PRINTER  "PRINTER"    /* user's printer */
  74.  
  75.  
  76. /*
  77.     External data used by DIO.C for directed I/O simulation:
  78. */
  79.  
  80. /*
  81. #define BUF_CONS 1    /* uncomment if console buffering is
  82.             desired    (see DIO.C)       */
  83. */
  84.  
  85. char _diflag, _doflag;    /* flag if directed I/O being used */
  86.  
  87. /* ----- CHANGE -----    define 3 more flags.
  88.  *            at present, _dispec is not used.
  89.  */
  90.  
  91. char _deflag;    /* like _deflag and _deflag but for STD_ERR */
  92. int _dispec, _dospec, _despec;    /* ERROR or direct output to
  93.                  * a special file.
  94.                  */
  95.  
  96. char _pipef, *_pipedest;   /* true if a pipe is being filled */
  97. char **_savei, **_nullpos; /* used to remember position in
  98.                   command line when piping          */
  99. char _dibuf[BUFSIZ], _dobuf[BUFSIZ];    /* I/O buffers used for direction  */
  100.  
  101. /* ----- CHANGE ----- a new buffer is needed */
  102.  
  103. char _debuf[BUFSIZ];
  104.  
  105. #ifdef BUF_CONS                /* console buffering data       */
  106.  
  107. char _conbuf[MAXLINE + 2];        /* console input buffer used for 
  108.                        non-directed standard input       */
  109. char *_conbufp;                /* pointer to next character to
  110.                         read from console buffer   */
  111. #endif
  112. irected standard input       */
  113. char *_conbufp;                /* pointer to next